package com.torres.system.controller;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.Authentication;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.torres.system.entity.AdminEntity;
import com.torres.system.entity.VersionEntity;

import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

@RestController
@Slf4j
@RequestMapping("/index")
public class IndexController {

	@GetMapping("")
    @ApiOperation(value = "首页")
    public ModelAndView index(Authentication authentication) {
		AdminEntity entity = new AdminEntity();
		entity.setName(authentication.getName());
		Object obj = authentication.getDetails();
		ModelAndView modelAndView = new ModelAndView("/home");
		modelAndView.addObject("admin", entity);
        return modelAndView;
    }
}
